import DexieObject from '@/core/DexieObject.js'
import db from '@/core/db.js'

function Task (name, rank, startDate, endDate) {
  this.name = name
  this.rank = rank || 'rank-1'
  this.startDate = startDate || new Date('Sat May 26 2018 00:00:00 GMT+0800').getTime()
  this.endDate = endDate || new Date('Sat May 26 2018 00:00:00 GMT+0800').getTime()

  DexieObject.call(this)
}

Task.prototype = Object.assign(
  Object.create(DexieObject.prototype),
  {
    constructor: Task,
    tableName: 'Task'
  }
)

db.Task.mapToClass(Task)
export default Task
